var host = "https://elitetest.feiyang56.cn/seekjobtest-restful-api/"//test
//var host = "https://elite.feiyang56.cn/seekjob-restful-api/"//正式idhzi
//var host = "http://192.168.3.254:9031/privilege-api/"
//var host = "http://192.168.3.233:9032/privilege-restful/"
const config = {
  host,
  // 用code换取openId
  openIdUrl: host + 'wxUtil/getOpenId',
  // 登录地址，用于建立会话
  loginUrl: host + 'loginController/userLogin',
  // 获取公司信息
  getCompanyInfoByIdUrl: host + 'companyController/getCompanyInfoById',
  // 修改公司信息
  editCompanyUrl: host + 'companyController/editCompany',
  // 添加公司信息
  saveCompanyUrl: host + 'companyController/saveCompany',
  // 获取收支列表
  queryJournalAccountList: host + 'workerWageFlowController/queryList',
  // 获取收支详细
  queryJournalAccountInfo: host + 'workerWageFlowController/queryInfo', 
  // 获取行业类型
  queryIndustryTypeList: host + 'industryTypeController/queryList',
  // 图片用户名
  fileUserName:'root',
  // 图片密码
  filePassWord: '123456',
  // 上传图片
  fileUploadUrl: 'https://tengyun.feiyang56.cn/filesystem/loginController/imageUpload.do?username=root&password=123456&file=',
  // 首页订单列表
  queryIndexOrderList: host + 'orderController/queryList',
  // 首页列表详情
  queryIndexOrderInfo: host + 'orderController/getOrder',
  // 业务类型
  queryIndexBusinessTypeInfo: host + 'businessTypeController/queryList',
  // 保存图片
  fileSaveUrl: 'https://tengyun.feiyang56.cn/filesystem/loginController/fileUrl.do?id=',
  // 接单
  queryIndexReceiptOrder: host + 'orderController/receiptOrder',
  // 订单完成
  queryIndexEditOrderStatus: host + 'orderController/editOrderStatus',
  // 获取个人会员信息
  getIndividualMemberdUrl: host + 'workerController/getIndividualMember',
  // 个人会员注册
  registerIndividualMemberUrl: host + 'workerController/registerIndividualMember',
  // 个人会员修改
  udpIndividualMember: host + 'workerController/udpIndividualMember',
  // 获取业务类型
  queryBusinessTypeList: host + 'businessTypeController/queryList',
  // 获取个人会员协议
  agreementUrl: host + 'agreement.html',
  // 请求地址
  requestUrl: host,
};

module.exports = config

//添加请求根目录
var rootDocment = host;
function req(url, data, cb) {
  wx.request({
    url: rootDocment + url,
    data: data,
    method: 'post',
    header: { 'Content-Type': 'application/x-www-form-urlencoded' },
    success: function (res) {
      return typeof cb == "function" && cb(res.data)
    },
    fail: function () {
      return typeof cb == "function" && cb(false)
    }
  })
}